﻿/** \file
* \$Rev: 184 $
* 
* \$Date: 2010-04-14 07:18:41 +0000 (Wed, 14 Apr 2010) $
*
* \$URL: http://chorus-twitter.googlecode.com/svn/trunk/src/gui/MainForm.cs $
*/

using System;
using System.Windows.Forms;

namespace chorus.gui
{
	/// <summary>
	/// The main application form.
	/// </summary>
	public partial class MainForm : Form
	{
		/// <summary>The constructor.</summary>
		public MainForm() { InitializeComponent(); }

		/// <summary>Add a view as an MDI window.</summary>
		/// <param name="view">The view to add.</param>
		public ViewForm AddView(net.View view)
		{
			ViewForm form = new ViewForm(view);
			form.Show();
			return form;
		}

		#region Event handlers

		/// <summary>Fired when the 'exit' menu item is clicked.</summary>
		/// <param name="sender">The event sender.</param>
		/// <param name="e">The event parameters.</param>
		void ExitToolsStripMenuItem_Click(object sender, EventArgs e) { Close(); }

		/// <summary>Fired when the toolbar is shown or hidden.</summary>
		/// <param name="sender">The event sender.</param>
		/// <param name="e">The event parameters.</param>
		void ToolBarToolStripMenuItem_Click(object sender, EventArgs e)
		{
			toolStrip.Visible = toolBarToolStripMenuItem.Checked;
		}

		/// <summary>Fired when the status bar is shown or hidden.</summary>
		/// <param name="sender">The event sender.</param>
		/// <param name="e">The event parameters.</param>
		void StatusBarToolStripMenuItem_Click(object sender, EventArgs e)
		{
			statusStrip.Visible = statusBarToolStripMenuItem.Checked;
		}

		/// <summary>Fired when the user wants MDI windows to be cascaded.</summary>
		/// <param name="sender">The event sender.</param>
		/// <param name="e">The event parameters.</param>
		void CascadeToolStripMenuItem_Click(object sender, EventArgs e) { LayoutMdi(MdiLayout.Cascade); }

		/// <summary>Fired when the user wants MDI windows to be tiled vertically.</summary>
		/// <param name="sender">The event sender.</param>
		/// <param name="e">The event parameters.</param>
		void TileVerticalToolStripMenuItem_Click(object sender, EventArgs e) { LayoutMdi(MdiLayout.TileVertical); }

		/// <summary>Fired when the user wants MDI windows to be tiled horizontally.</summary>
		/// <param name="sender">The event sender.</param>
		/// <param name="e">The event parameters.</param>
		void TileHorizontalToolStripMenuItem_Click(object sender, EventArgs e) { LayoutMdi(MdiLayout.TileHorizontal); }

		/// <summary>Fired when the user wants to arrange MDI window icons.</summary>
		/// <param name="sender">The event sender.</param>
		/// <param name="e">The event parameters.</param>
		void ArrangeIconsToolStripMenuItem_Click(object sender, EventArgs e) { LayoutMdi(MdiLayout.ArrangeIcons); }

		/// <summary>Fired when the user opens the accounts dialogue.</summary>
		/// <param name="sender">The event sender.</param>
		/// <param name="e">The event parameters.</param>
		void accountsToolStripMenuItem_Click(object sender, EventArgs e)
		{
			AccountForm accounts = new AccountForm();
			accounts.ShowDialog(this);
		}

		/// <summary>Fired when the user opens the views dialogue.</summary>
		/// <param name="sender">The event sender.</param>
		/// <param name="e">The event parameters.</param>
		void viewsToolStripMenuItem_Click(object sender, EventArgs e)
		{
			ManageViewForm viewman = new ManageViewForm();
			viewman.ShowDialog(this);
		}

		/// <summary>Fired when the user wants to refresh the current view.</summary>
		/// <param name="sender">The event sender.</param>
		/// <param name="e">The event parameters.</param>
		void refreshCurrentViewToolStripMenuItem_Click(object sender, EventArgs e)
		{
			((ViewForm)ActiveMdiChild).RefreshMessages();
		}

		#endregion
	}
}
